package com.gitee.wsl.struct.tree.sample.binary

import com.gitee.wsl.struct.tree.NodeElement
import com.gitee.wsl.struct.tree.TreeElement

interface BinaryTreeElement<V,T : BinaryTreeNode<V, T>> : TreeElement<V, T> {
    val leftNode : T ?
    val rightNode: T ?
}

/**
 * A [TreeNode] specialization with only two child nodes, left and right.
 *
 * @param <T> the actual implementation type of this tree node
</T> */
interface BinaryTreeNode<V,T : BinaryTreeNode<V, T>> : BinaryTreeElement<V, T>, NodeElement<V, T> {

    override val children: List<T>
        get() = listOfNotNull(leftNode, rightNode)

}
